﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using PluginManager.Plugin;
using UnityEngine;

namespace Input_test
{
    [OnGameInit]
    public class Mod:MonoBehaviour
    {

        void Start()
        {
            Debug.Log("input test");
        }


        void Update()
        {
            //if (Input.GetKey(KeyCode.H))
            //{
            //    keybd_event(65, 0, 0, 0);
            //    keybd_event(65, 0, 1, 0);
            //    keybd_event(65, 0, 2, 0);

            //}

            //if (Input.GetKeyDown(KeyCode.A))
            //{
            //    Debug.Log("按下了A键");
            //}
            //if (Input.GetKey(KeyCode.A))
            //{
            //    Debug.Log("按住了A键");
            //}

            //if (Input.GetKeyUp(KeyCode.A))
            //{
            //    Debug.Log("释放了A键");
            //}
            if (Input.GetKeyDown(KeyCode.G))
            {
                var tran = MouseOrbit.Instance.target;
                if (tran.name.ToLower() == "spinningblock" || tran.name.ToLower() == "wheel")
                {
                    tran.GetComponent<CogMotorControllerHinge>().SpeedSlider.Value += 0.5f;
                }
            }
           

               
        }


        [DllImport("user32.dll", EntryPoint = "keybd_event")]
        public static extern void keybd_event(

           byte bVk,    //虚拟键值 对应按键的ascll码十进制值

           byte bScan,// 0

           int dwFlags,  //0 为按下，1按住，2为释放

           int dwExtraInfo  // 0

       );         

    }
}
